#include <bits/stdc++.h>
using namespace std;
double pi = acos(-1);
int a, b;
// -(2*a*b*(acos((a + x)/a - pi)*(pi - (a + x)/a) + (1 - (pi - (a +
// x)/a)^2)^(1/2)))/pi
double func(int x) {
  return -2 * b * x - (2 * b *
                       (a * sqrt(1 - (a + x) * (a + x) / (a * a)) -
                        acos((a + x) / a) * (a + x))) /
                          pi;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    cin >> a >> b;
    double res = pi * a * a + 2 * (func(-2 * a));
    printf("%.10lf\n", res);
  }
}
